package com.hxzy.projectssmplus.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hxzy.projectssmplus.entity.HouseSupport;
import com.hxzy.projectssmplus.mapper.HouseSupportMapper;
import com.hxzy.projectssmplus.service.HouseSupportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class HouseSupportServiceImpl extends ServiceImpl<HouseSupportMapper,HouseSupport> implements HouseSupportService {
    @Autowired
    private HouseSupportMapper houseSupportMapper;
    @Override
    public HouseSupport supportOne(Long houseId) {
        QueryWrapper<HouseSupport> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("house_id",houseId);
        HouseSupport houseSupport = this.houseSupportMapper.selectOne(queryWrapper);
        return houseSupport;
    }

    @Override
    public Integer supportUpdata(HouseSupport houseSupport) {
        int i = this.houseSupportMapper.updateById(houseSupport);
        return i;

    }

    @Override
    public Integer supportAdd(HouseSupport houseSupport) {
        int insert = this.houseSupportMapper.insert(houseSupport);
        return insert;
    }
}
